(bug 16877) When moving a page over a redirect, delete the creation entry for the...
authorAlex Z <mrzman@users.mediawiki.org>
Wed, 22 Jul 2009 20:09:23 +0000 (20:09 +0000)
committerAlex Z <mrzman@users.mediawiki.org>
Wed, 22 Jul 2009 20:09:23 +0000 (20:09 +0000)
RELEASE-NOTES
includes/Title.php

index 56048cd..dc4b407 100644 (file)
@@ -312,6 +312,8 @@ this. Was used when mwEmbed was going to be an extension.
   "enhanced recent changes"
 * (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks
   target page
+* (bug 16877) Moving a page over a redirect no longer leaves an orphan entry in
+  the recentchanges table
 
 == API changes in 1.16 ==
 
index 0051360..912ed9d 100644 (file)
@@ -2812,6 +2812,9 @@ class Title {
                $newid = $nt->getArticleID();
                $oldid = $this->getArticleID();
                $latest = $this->getLatestRevID();
+               $rcts = $dbw->timestamp( $nt->getEarliestRevTime() );
+               $newns = $nt->getNamespace();
+               $newdbk = $nt->getDBkey();
 
                $dbw = wfGetDB( DB_MASTER );
 
@@ -2833,6 +2836,11 @@ class Title {
                        $dbw->delete( 'langlinks', array( 'll_from' => $newid ), __METHOD__ );
                        $dbw->delete( 'redirect', array( 'rd_from' => $newid ), __METHOD__ );
                }
+               // If the redirect was recently created, it may have an entry in recentchanges still    
+               $dbw->delete( 'recentchanges', 
+                       array( 'rc_timestamp' => $rcts, 'rc_namespace' => $newns, 'rc_title' => $newdbk, 'rc_new' => 1 ), 
+                       __METHOD__
+               );
 
                # Save a null revision in the page's history notifying of the move
                $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );